<head>
    <link href="${ctx}/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="${ctx}/font-awesome/3.0.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="${ctx}/css/index.css" rel="stylesheet">
    <link href="${ctx}/bootstrap-table/1.12.0/bootstrap-table.min.css" rel="stylesheet">
    <script src="${ctx}/jquery/2.1.4/jquery.min.js"></script>
    <script src="${ctx}/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="${ctx}/bootstrap-table/1.12.0/bootstrap-table.min.js"></script>
    <script src="${ctx}/bootstrap-table/1.12.0/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="${ctx}/bootstrap-table/1.12.0/extensions/export/bootstrap-table-export.min.js"></script>
    <script src="${ctx}/js/extends.js"></script>
    <script src="${ctx}/layui/layui.all.js"></script>
    <script src="${ctx}/js/util.js"></script>
    <link href="${ctx}/layui/css/layui.css" rel="stylesheet">
    <link href="${ctx}/wangEditor/3.1.1/wangEditor.min.css" rel="stylesheet">
    <script src="${ctx}/wangEditor/10.0.13/wangEditor.min.js"></script>
    <style>
        .btn {
            font-size: 12px;
        }

        .line_item {
            display: inline-block;
            height: 43px;
            margin-right: 10px;
        }

        .line_lab {
            padding: 0;
            line-height: 38px;
            width: 160px;
            margin-right: 10px;
            float: left;
        }

        .line_block {
            width: 300px;
            margin-left: 0;
            float: left;
        }

        .line_block input {
            padding-right: 10px;
        }

        .data_table {
            padding: 0 25px;
        }

        .layui-form-checkbox[lay-skin=primary] i {
            top: 5px;
        }

        .intro_lab {
            display: flex;
            padding-left: 170px;
            margin-bottom: 10px;
        }

        .intro_lab span {
            display: block;
            width: 99px;
            color: #5FB878;
        }
    </style>
</head>
<body>
<br><br>

<form class="layui-form" action="" lay-filter="item" style="width: 500px;margin: 0 auto;">


    <input type="hidden" name="id" readonly value="${item.id!''}">
    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>数据源标识</label>
        <div class="layui-input-block line_block">
            <input type="text" name="sdkKey" lay-verify="required" placeholder="数据源标识"
                   autocomplete="off" class="layui-input" value="${item.sdkKey!''}">
        </div>
    </div>

    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab"><span class="c-red">*</span>数据源名称</label>
        <div class="layui-input-block line_block">
            <input type="text" name="taskName" lay-verify="required" placeholder="数据源名称"
                   autocomplete="off" class="layui-input" value="${item.taskName!''}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label line_lab">提示语句</label>
        <div class="layui-input-block line_block">
            <input type="radio" name="prompt" value="0" title="下载体验" lay-filter="prompt"
                    <#if item.prompt??>
                        <#if item.prompt==0>checked</#if>
                    <#else>
                        checked
                    </#if>
            >
            <input type="radio" name="prompt" value="1" title="下载注册" lay-filter="prompt"
                    <#if item.prompt??>
                        <#if item.prompt==1>checked</#if>
                    </#if>
            >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label line_lab">奖励类型</label>
        <div class="layui-input-block line_block">
            <input type="radio" name="rewardType" value="1" title="(金钱(分))" lay-filter="rewardType"
                   <#if item.rewardType==1>checked</#if>>
            <input type="radio" name="rewardType" value="0" title="(金币)" lay-filter="rewardType"
                   <#if item.rewardType==0>checked</#if>>
        </div>
    </div>
    <div class="layui-form-item line_item payScore">
        <label class="layui-form-label line_lab">首次下载奖励金额(分)</label>
        <div class="layui-input-block line_block">
            <input type="number" name="firstReward" placeholder="首次下载奖励金额(分)" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.firstReward!''}">
            <input type="number" name="firstRewardReduction" placeholder="每日衰减" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.firstRewardReduction!''}">
            <input type="number" name="firstRewardMin" placeholder="最小金额" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.firstRewardMin!''}">
        </div>
    </div>

    <div class="layui-form-item line_item payScore">
        <label class="layui-form-label line_lab">二次激活奖励值金额(分)</label>
        <div class="layui-input-block line_block">
            <input type="number" name="rouseReward" placeholder="二次激活奖励值金额(分)" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.rouseReward!''}">
            <input type="number" name="rouseRewardReduction" placeholder="每日衰减" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.rouseRewardReduction!''}">
            <input type="number" name="rouseRewardMin" placeholder="最小金额" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.rouseRewardMin!''}">
        </div>
    </div>


    <div class="layui-form-item line_item payScore">
        <label class="layui-form-label line_lab">浏览型奖励值金额(分)</label>
        <div class="layui-input-block line_block">
            <input type="number" name="lookReward" placeholder="二次激活奖励值金额(分)" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.lookReward!''}">
            <input type="number" name="lookRewardReduction" placeholder="每日衰减" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.lookRewardReduction!''}">
            <input type="number" name="lookRewardMin" placeholder="最小金额" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.lookRewardMin!''}">
        </div>
    </div>
    <div class="layui-form-item line_item payScore">
        <label class="layui-form-label line_lab">签到金钱（分）</label>
        <div class="layui-input-block line_block">
            <input type="text" name="clickMoney" placeholder="签到金钱（分）" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.clickMoney!40}">
            <input type="number" name="clickMoneyReduction" placeholder="每日衰减" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.clickMoneyReduction!''}">
            <input type="number" name="clickMoneyMin" placeholder="最小金额" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.clickMoneyMin!''}">
        </div>
    </div>

    <div class="intro_lab">
        <span>第一天</span>
        <span>每日衰减</span>
        <span>最小值</span>
    </div>

    <div class="layui-form-item line_item payGold">
        <label class="layui-form-label line_lab">首次下载奖励金币</label>
        <div class="layui-input-block line_block">
            <input type="number" name="firstRewardPoint" placeholder="首次下载奖励金币" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.firstRewardPoint!''}">
            <input type="number" name="firstRewardPointReduction" placeholder="每日衰减" autocomplete="off"
                   class="layui-input" style="width: 33%;float: left;" value="${item.firstRewardPointReduction!''}">
            <input type="number" name="firstRewardPointMin" placeholder="最小金额" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.firstRewardPointMin!''}">
        </div>
    </div>

    <div class="layui-form-item line_item payGold">
        <label class="layui-form-label line_lab">二次激活奖励值金币</label>
        <div class="layui-input-block line_block">
            <input type="number" name="rouseRewardPoint" placeholder="二次激活奖励值金币" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.rouseRewardPoint!''}">
            <input type="number" name="rouseRewardPointReduction" placeholder="每日衰减" autocomplete="off"
                   class="layui-input" style="width: 33%;float: left;" value="${item.rouseRewardPointReduction!''}">
            <input type="number" name="rouseRewardPointMin" placeholder="最小金额" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.rouseRewardPointMin!''}">
        </div>
    </div>


    <div class="layui-form-item line_item payGold">
        <label class="layui-form-label line_lab">浏览型奖励值金币</label>
        <div class="layui-input-block line_block">
            <input type="number" name="lookRewardPoint" placeholder="二次激活奖励值金币" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.lookRewardPoint!''}">
            <input type="number" name="lookRewardPointReduction" placeholder="每日衰减" autocomplete="off"
                   class="layui-input" style="width: 33%;float: left;" value="${item.lookRewardPointReduction!''}">
            <input type="number" name="lookRewardPointMin" placeholder="最小金额" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.lookRewardPointMin!''}">
        </div>
    </div>
    <div class="layui-form-item line_item payGold">
        <label class="layui-form-label line_lab">签到金币</label>
        <div class="layui-input-block line_block">
            <input type="text" name="clickPoint" placeholder="签到金币" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.clickPoint!60}">
            <input type="number" name="clickPointReduction" placeholder="每日衰减" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.clickPointReduction!''}">
            <input type="number" name="clickPointMin" placeholder="最小金额" autocomplete="off" class="layui-input"
                   style="width: 33%;float: left;" value="${item.clickPointMin!''}">
        </div>
    </div>


    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab">每日必赚广告权重</label>
        <div class="layui-input-block line_block">
            <input type="text" name="weight" placeholder="每日必赚广告权重"
                   autocomplete="off" class="layui-input" value="${item.weight!1}">
        </div>
    </div>

    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab">老用户每日必赚每天最大完成数量</label>
        <div class="layui-input-block line_block">
            <input type="number" name="maxDayCount" placeholder="每日必赚每天最大完成数量"
                   autocomplete="off" class="layui-input" value="${item.maxDayCount!1}">
        </div>
    </div>
    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab">新用户每日必赚每天最大完成数量</label>
        <div class="layui-input-block line_block">
            <input type="number" name="newMaxDayCount" placeholder="每日必赚每天最大完成数量"
                   autocomplete="off" class="layui-input" value="${item.newMaxDayCount!1}">
        </div>
    </div>

    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab">天天赚钱广告权重</label>
        <div class="layui-input-block line_block">
            <input type="text" name="secondWeight" placeholder="天天赚钱广告权重"
                   autocomplete="off" class="layui-input" value="${item.secondWeight!1}">
        </div>
    </div>
    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab">浏览体验时间（秒）</label>
        <div class="layui-input-block line_block">
            <input type="text" name="lookTime" placeholder="浏览体验时间（秒）"
                   autocomplete="off" class="layui-input" value="${item.lookTime!60}">
        </div>
    </div>
    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab">下载型体验时间（秒）</label>
        <div class="layui-input-block line_block">
            <input type="text" name="rouseTime" placeholder="下载型体验时间（秒）"
                   autocomplete="off" class="layui-input" value="${item.rouseTime!60}">
        </div>
    </div>


    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab">屏蔽渠道</label>
        <div class="layui-input-block line_block">
            <input type="text" name="brand" placeholder="广告屏蔽渠道"
                   autocomplete="off" class="layui-input" value="${item.brand!''}">
        </div>
    </div>
    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab">app版本</label>
        <div class="layui-input-block line_block">
            <input type="number" name="version" placeholder="app版本"
                   autocomplete="off" class="layui-input" value="${item.version!''}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label line_lab">签到开关</label>
        <div class="layui-input-block line_block">
            <input type="radio" name="hasClick" value="1" title="开" <#if item.hasClick==1>checked</#if>>
            <input type="radio" name="hasClick" value="0" title="关" <#if item.hasClick==0>checked</#if>>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label line_lab">拉回开关</label>
        <div class="layui-input-block line_block">
            <input type="radio" name="openReturn" value="1" title="开" <#if item.openReturn==1>checked</#if>>
            <input type="radio" name="openReturn" value="0" title="关" <#if item.openReturn==0>checked</#if>>
        </div>
    </div>


    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab">接收任务提示</label>
        <div class="layui-input-block line_block">
            <input type="text" name="acceptTaskTip" placeholder="接收任务提示"
                   autocomplete="off" class="layui-input" value="${item.acceptTaskTip!''}">
        </div>
    </div>

     <p>攻略提示</p><div id="editor" style="width: 90%;margin-left: 50px;"></div>

    <p>签到攻略提示</p><div id="editor1" style="width: 90%;margin-left: 50px;"></div>

    <div class="layui-form-item">
        <label class="layui-form-label line_lab">体验提示开关</label>
        <div class="layui-input-block line_block">
            <input type="radio" name="experienceTipSwitch" value="1" title="开" <#if item.experienceTipSwitch??&&item.experienceTipSwitch==1>checked</#if>>
            <input type="radio" name="experienceTipSwitch" value="0" title="关" <#if item.experienceTipSwitch??&&item.experienceTipSwitch==0>checked</#if>>
        </div>
    </div>

    <p>体验提示</p><div id="editor2" style="width: 90%;margin-left: 50px;"></div>

    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab">出现体验提示概率</label>
        <div class="layui-input-block line_block">
            <input type="text" name="experienceTipRate" placeholder="出现体验提示概率"
                   autocomplete="off" class="layui-input" value="${item.experienceTipRate!''}">
        </div>
    </div>

    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab">清零秒数</label>
        <div class="layui-input-block line_block">
            <input type="text" name="cleanZeroSecond" placeholder="清零秒数"
                   autocomplete="off" class="layui-input" value="${item.cleanZeroSecond!''}">
        </div>
    </div>
    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab">sdk最大上限次数</label>
        <div class="layui-input-block line_block">
            <input type="number" name="maxCount" placeholder="sdk最大上限次数"
                   autocomplete="off" class="layui-input" value="${item.maxCount!999}">
        </div>
    </div>
    <div class="layui-form-item line_item">
        <label class="layui-form-label line_lab">新用户不提示天数</label>
        <div class="layui-input-block line_block">
            <input type="text" name="noTipDay" placeholder="新用户不提示天数"
                   autocomplete="off" class="layui-input" value="${item.noTipDay!''}">
        </div>
    </div>



    <div class="layui-form-item">
        <div class="layui-input-block" style="text-align: center;margin: 0">
            <button class="layui-btn" lay-submit lay-filter="formUpdate">保存</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<textarea style="display: none;" id="tip1">${item.strategyTip!''}</textarea>
<textarea style="display: none;" id="tip2">${item.clickStrategyTip!''}</textarea>
<textarea style="display: none;" id="tip3">${item.experienceTip!''}</textarea>
<script>

    var E = window.wangEditor
    var editor = new E('#editor')
    var editor1 = new E('#editor1')
    var editor2 = new E('#editor2')
    $(document).ready(function () {


        editor.create();
        editor1.create();
        editor2.create();


        editor.txt.html($("#tip1").val());
        editor1.txt.html($("#tip2").val());
        editor2.txt.html($("#tip3").val());


        let rewardType = '${item.rewardType}';
        if (rewardType === '1') {
            $(".payScore").show();
            $(".payGold").hide();

        } else if (rewardType === '0') {
            $(".payScore").hide();
            $(".payGold").show();

        } else {
            $(".payScore").hide();
            $(".payGold").hide();

        }


        layui.use('form', function () {

            var form = layui.form;
            form.render();
            form.on('submit(formUpdate)', function (data) {
                data.field.strategyTip = editor.txt.html();
                data.field.clickStrategyTip = editor1.txt.html();
                data.field.experienceTip = editor2.txt.html();
                $.ajax({
                    url: "/sys/newrouse/edit",    //请求的url地址
                    dataType: "json",   //返回格式为json
                    async: true,//请求是否异步，默认为异步，这也是ajax重要特性
                    data: data.field,    //参数值,键值对
                    type: "post",   //请求方式
                    beforeSend: function () {
                        //请求前的处理
                    },
                    success: function (req) {
                        //请求成功时处理
                        if (req.success) {
                            parent.showmsg(req.message);
                            parent.search();
                            layer.msg(req.message)
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭

                        } else {
                            layer.msg(req.message)
                        }
                    },
                    complete: function () {
                        //请求完成的处理
                    },
                    error: function () {
                        //请求出错处理
                        layer.msg("请重试！若在失败请联系管理员")
                    }
                });

                return false;
            });


            form.on("radio(rewardType)", function (data) {
                if (this.value === '1') {
                    $(".payScore").show();
                    $(".payGold").hide();

                } else if (this.value === '0') {
                    $(".payScore").hide();
                    $(".payGold").show();

                } else {
                    $(".payScore").hide();
                    $(".payGold").hide();

                }
            });


        });


    });


</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>